import request from "../utils/request"

let cookie = encodeURIComponent(sessionStorage.getItem('cookie'))


// 手机登录
export const PhoneLogin = (data) => {
    return request({
        url: '/login/cellphone',
        params: data
    })
}

// 游客登录
export const AnonimousLogin = () => {
    return request({
        url: '/register/anonimous',
    })
}
// 二维码登录
// 1.获取key
export const getKey = () => {
    return request({
        url: '/login/qr/key',
        params: {
            timestamp: new Date().getTime()
        }
    })
}
// 2.获取生成二维码的Base64
export const getQrcodeImg = (key) => {
    return request({
        url: '/login/qr/create',
        params: {
            qrimg: true,
            key,
            timestamp: new Date().getTime()
        }
    })
}
// 3.二维码扫码状态检查
export const getQrcodeCheck = (key) => {
    return request({
        url: '/login/qr/check',
        params: {
            key,
            timestamp: new Date().getTime()
        }
    })
}

// 获取登录状态
export const getStatus = () => {
    return request({
        url: '/login/status',
    })
}
// 获取账号信息
export const getAccount = () => {
    return request({
        url: '/user/account',
        method: 'post',
        data: {
            cookie: sessionStorage.getItem('cookie')
        }
    })
}
// 获取用户信息 , 歌单，收藏，mv, dj 数量
export const getSubcount = () => {
    return request({
        url: '/user/subcount',
        method: 'post',
        data: {
            cookie
        }
    })
}
// 获取用户详细信息
export const getUserDetail = (uid) => {
    return request({
        url: '/user/detai?' + uid,
        method: 'post',
        data: {
            cookie
        }
    })
}
